package com.yeren.example.simpleEmail;

import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

public class simpleEmailDemo {
	public static void main(String[] args) throws EmailException {
		
		Email email = new SimpleEmail();
		email.setHostName("smtp.qq.com");
		email.setSmtpPort(465);
		email.setAuthenticator(new DefaultAuthenticator("623486747@qq.com", "yr12345678"));
		email.setSSLOnConnect(true);
		email.setFrom("623486747@qq.com","yeren108");
		email.setSubject("TestMail--");//设置主题
		email.setMsg("www.baidu.com");//定义邮件内容
//		email.addTo("liubiao@wondersgroup.com");//添加一个收件人的电子邮件列表
		email.addTo("623486747@qq.com");//添加一个收件人的电子邮件列表
		email.send();//发送邮件
		System.out.println("==");
		
	}
}
